home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / misc1 / iv26_w30.zip / EXAMPLES / IDRAW / MAPIPAIN.H < prev    next >
C/C++ Source or Header  |  1980-01-05  |  4KB  |  180 lines

  1. /*
  2.  * Copyright (c) 1987, 1988, 1989 Stanford University
  3.  *
  4.  * Permission to use, copy, modify, distribute, and sell this software and its
  5.  * documentation for any purpose is hereby granted without fee, provided
  6.  * that the above copyright notice appear in all copies and that both that
  7.  * copyright notice and this permission notice appear in supporting
  8.  * documentation, and that the name of Stanford not be used in advertising or
  9.  * publicity pertaining to distribution of the software without specific,
  10.  * written prior permission.  Stanford makes no representations about
  11.  * the suitability of this software for any purpose.  It is provided "as is"
  12.  * without express or implied warranty.
  13.  *
  14.  * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  15.  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
  16.  * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  17.  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  18.  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  19.  * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
  20.  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  21.  */
  22.  
  23. // $Header: mapipaint.h,v 1.7 89/10/09 14:49:01 linton Exp $
  24. // declares MapIPaint subclasses.
  25.  
  26. #ifndef mapipaint_h
  27. #define mapipaint_h
  28.  
  29. #include <InterViews/defs.h>
  30.  
  31. // Declare imported types.
  32.  
  33. class BaseList;
  34. class BaseNode;
  35. class IBrush;
  36. class IBrushList;
  37. class IColor;
  38. class IColorList;
  39. class IFont;
  40. class IFontList;
  41. class IPattern;
  42. class IPatternList;
  43. class Interactor;
  44.  
  45. // A MapIPaint creates a list of predefined and user-defined entries.
  46.  
  47. class MapIPaint {
  48. protected:
  49.  
  50.     void Init(BaseList*, Interactor*, const char*);
  51.     void DefineEntries(BaseList*, Interactor*, const char*);
  52.     void DefineInitial(Interactor*, const char*);
  53.     virtual BaseNode* CreateEntry(const char*);
  54.  
  55.     int initial;        // denotes which entry is used on startup
  56.  
  57. };
  58.  
  59. // A MapIBrush manages a list of predefined and user-defined brushes.
  60.  
  61. class MapIBrush : public MapIPaint {
  62. public:
  63.  
  64.     MapIBrush(Interactor*, const char*);
  65.     ~MapIBrush();
  66.  
  67.     int Size();
  68.     boolean AtEnd();
  69.     IBrush* First();
  70.     IBrush* Last();
  71.     IBrush* Prev();
  72.     IBrush* Next();
  73.     IBrush* GetCur();
  74.     IBrush* Index(int);
  75.     boolean Find(IBrush*);
  76.     IBrush* GetInitial();
  77.  
  78.     IBrush* FindOrAppend(boolean, int, int, int, int);
  79.  
  80. protected:
  81.  
  82.     BaseNode* CreateEntry(const char*);
  83.  
  84.     IBrushList* ibrushlist;        // stores idraw's IBrushes
  85.  
  86. };
  87.  
  88. // A MapIColor manages a list of predefined and user-defined colors.
  89.  
  90. class MapIColor : public MapIPaint {
  91. public:
  92.  
  93.     MapIColor(Interactor*, const char*);
  94.     ~MapIColor();
  95.  
  96.     int Size();
  97.     boolean AtEnd();
  98.     IColor* First();
  99.     IColor* Last();
  100.     IColor* Prev();
  101.     IColor* Next();
  102.     IColor* GetCur();
  103.     IColor* Index(int);
  104.     boolean Find(IColor*);
  105.     IColor* GetInitial();
  106.  
  107.     IColor* FindOrAppend(const char*, int, int, int);
  108.  
  109. protected:
  110.  
  111.     BaseNode* CreateEntry(const char*);
  112.  
  113.     IColorList* icolorlist;        // stores idraw's IColors
  114.  
  115. };
  116.  
  117. // A MapIFont manages a list of predefined and user-defined fonts.
  118.  
  119. class MapIFont : public MapIPaint {
  120. public:
  121.  
  122.     MapIFont(Interactor*, const char*);
  123.     ~MapIFont();
  124.  
  125.     int Size();
  126.     boolean AtEnd();
  127.     IFont* First();
  128.     IFont* Last();
  129.     IFont* Prev();
  130.     IFont* Next();
  131.     IFont* GetCur();
  132.     IFont* Index(int);
  133.     boolean Find(IFont*);
  134.     IFont* GetInitial();
  135.  
  136.     IFont* FindOrAppend(const char*, const char*, const char*);
  137.  
  138. protected:
  139.  
  140.     BaseNode* CreateEntry(const char*);
  141.  
  142.     IFontList* ifontlist;        // stores idraw's IFonts
  143.  
  144. };
  145.  
  146. // A MapIPattern manages a list of predefined and user-defined
  147. // patterns.
  148.  
  149. class MapIPattern : public MapIPaint {
  150. public:
  151.  
  152.     MapIPattern(Interactor*, const char*);
  153.     ~MapIPattern();
  154.  
  155.     int Size();
  156.     boolean AtEnd();
  157.     IPattern* First();
  158.     IPattern* Last();
  159.     IPattern* Prev();
  160.     IPattern* Next();
  161.     IPattern* GetCur();
  162.     IPattern* Index(int);
  163.     boolean Find(IPattern*);
  164.     IPattern* GetInitial();
  165.  
  166.     IPattern* FindOrAppend(boolean, float, int*, int);
  167.  
  168. protected:
  169.  
  170.     BaseNode* CreateEntry(const char*);
  171.     int CalcBitmap(float);
  172.  
  173.     void ExpandToFullSize(int*, int);
  174.  
  175.     IPatternList* ipatternlist;        // stores idraw's IPatterns
  176.  
  177. };
  178.  
  179. #endif
  180.